<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS 魔方</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #e0e0e0;
            perspective: 600px;
        }

        .cube {
            position: relative;
            width: 100px;
            height: 100px;
            transform-style: preserve-3d;
            animation: rotate 5s infinite linear;
        }

        .face {
            position: absolute;
            width: 100px;
            height: 100px;
            border: 2px solid #000;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 24px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
            color: white;
            font-weight: bold;
            border-radius: 5px;
        }

        .front  { transform: translateZ(50px); background-color: #ff5733; } /* 亮红色 */
        .back   { transform: rotateY(180deg) translateZ(50px); background-color: #33c1ff; } /* 亮蓝色 */
        .right  { transform: rotateY(90deg) translateZ(50px); background-color: #75ff33; } /* 亮绿色 */
        .left   { transform: rotateY(-90deg) translateZ(50px); background-color: #ffeb33; } /* 亮黄色 */
        .top    { transform: rotateX(90deg) translateZ(50px); background-color: #ff33a1; } /* 亮粉色 */
        .bottom { transform: rotateX(-90deg) translateZ(50px); background-color: #a133ff; } /* 亮紫色 */

        @keyframes rotate {
            from { transform: rotateX(0) rotateY(0); }
            to { transform: rotateX(360deg) rotateY(360deg); }
        }
    </style>
</head>
<body>
    <div class="cube">
        <div class="face front">Front</div>
        <div class="face back">Back</div>
        <div class="face right">Right</div>
        <div class="face left">Left</div>
        <div class="face top">Top</div>
        <div class="face bottom">Bottom</div>
    </div>
</body>
</html>
